package db9;

public class Account {
    String id;
    double balance;
    public Account(){

    }
    public Account(String id,double balance){
        this.id=id;
        this.balance=balance;
    }
    public void save(double d) throws BNEException{
        balance=balance+d;
        System.out.println("账户："+id+"余额"+balance);
    }
    public void pay(double d)throws BNEException{
        double b =balance;
        if ((b-d)<0){
            throw new BNEException("余额不足");
        }
        balance=balance-d;
        System.out.println("账户："+id+"余额"+balance);
    }
}
